export default {
  namespaced: true,
  state: {
    // 当前角色可以访问的菜单
    menus: []
  },
  mutations: {
    SET_MENUS: (state, menus) => {
      state.menus = menus
      // console.log(JSON.stringify(menus));
      window.localStorage.setItem("menus", JSON.stringify(menus))
      // console.log(JSON.parse(window.localStorage.getItem("menus")));
    },
  },
  getters: {
    SAVE_MENUS: (state) => {
      if (!state.menus) {
        state.menus=JSON.parse(window.localStorage.getItem("menus"))
      }
      return state.menus
    }
  }
}
